/*
 * Copyright (c) 2011-2014 BlackBerry Limited.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef ApplicationUI_HPP_
#define ApplicationUI_HPP_
#include <QtCore/QObject>
#include <QNetworkAccessManager>

namespace de {
    namespace heimweghelden {
        class LocationHandler;
        namespace user {
            class ContactManager;
        }
    }
}
namespace bb
{
    namespace cascades
    {
        class LocaleHandler;
        namespace maps
        {
            class MapView;
        }
        namespace places {
            class SelectedPlace;
        }
    }
    namespace platform
    {
        namespace geo
        {
            class GeoLocation;
        }
    }
}
class QTranslator;
class QNetworkReply;
/*!
 * @brief Application UI object
 *
 * Use this object to create and init app UI, to create context objects, to register the new meta types etc.
 */
class ApplicationUI : public QObject
{
    Q_OBJECT
    Q_PROPERTY(de::heimweghelden::LocationHandler* locationHandler READ locationHandler CONSTANT);
public:
    ApplicationUI();
    virtual ~ApplicationUI();
    QNetworkAccessManager* networkmanager() const {
        return _networkmanager;
    };
signals:
    Q_INVOKABLE void onAppStatusChanged(int status);
public Q_SLOTS:
    void alert(const QString &message, bool fatal);
private slots:
    void changeAppStatus(int status);
    void onSystemLanguageChanged();
private:
    int appStatus;
    de::heimweghelden::LocationHandler* _locationHandler;
    de::heimweghelden::LocationHandler* locationHandler() const {
        return _locationHandler;
    };

    de::heimweghelden::user::ContactManager* _contactManager;
    de::heimweghelden::user::ContactManager* contactManager() const {
        return _contactManager;
    };
    QNetworkAccessManager* _networkmanager;

    QTranslator* m_pTranslator;
    bb::cascades::LocaleHandler* m_pLocaleHandler;

    bb::cascades::maps::MapView* mapView;
    bb::platform::geo::GeoLocation* deviceLocation;
    bb::platform::geo::GeoLocation* destinationLocation;
};

#endif /* ApplicationUI_HPP_ */
